import request from '@/utils/request'

export default {
// 搜索
selectByKeyWord(keyWord) {
    // debugger
    return request({
      url: '/fund/selectkey?select='+keyWord,
      method: 'get',
      params: { keyWord }
    })
  },

  
  addOneBooks(addData) {
    // debugger
    return request({
      url: '/member/books/insert',
      method: 'post',
      data: { 
        "author": addData.author,
        "bookName": addData.bookName,
        "bookType": addData.bookType,
        "description": addData.description,
        "image": addData.image,
        "uploader": JSON.parse(localStorage.getItem("user")).username
       }
    })
  },
  
  addAllbooks(addData) {
    // debugger
    return request({
      url: '/member/books/uploadAll',
      method: 'post',
      data: { 
        "author": addData.author,
        "bookName": addData.bookName,
        "bookType": addData.bookType,
        "description": addData.description,
        "image": addData.image,
        "src": addData.src,
        "uploader": JSON.parse(localStorage.getItem("user")).username
       }
    })
  },
  addnewChapter(addData){
    return request({
      url: '/member/chapter/insert',
      method: 'post',
      data: { 
        "bookId": addData.bookId,
        "chapterNum": addData.chapterNum,
        "content": addData.content,
        "title": addData.title,
       
       }
    })
  },


}